package pro.cherish.knowledgeumldesignpattern.designPattern.com.cherish.factory.simplefactory;

import pro.cherish.knowledgeumldesignpattern.designPattern.com.cherish.factory.Car;
import pro.cherish.knowledgeumldesignpattern.designPattern.com.cherish.factory.simplefactory.CarFactory;

//简单工厂模式(也是工厂模式) 一般使用静态方法，也叫静态工厂方法
//问题:如果需要添加新的子类,就需要修改代码,违反了开闭原则  但是不是不能用
public class client2 {
    public static void main(String [] args){
        Car audi = CarFactory.create("奥迪");
        Car byd = CarFactory.create("比亚迪");
        audi.run();
        byd.run();
        CarFactory2.createAudi().run();
        CarFactory2.createByd().run();
    }
}
